package com.qst.consumer.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qst.consumer.common.BaseResponse;
import com.qst.consumer.common.ResultUtils;
import com.qst.consumer.model.domain.Article;
import com.qst.consumer.model.request.UserSearchRequest;
import com.qst.consumer.service.ArticleService;
import com.qst.consumer.service.UserService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/article")
@CrossOrigin(origins = {"http://localhost:5173"})
public class ArticleController {
    @Resource
    private ArticleService articleService;
    @GetMapping("/search")
    public BaseResponse<List<Article>> searchArticles(HttpServletRequest request) {
        QueryWrapper<Article> queryWrapper = new QueryWrapper<>();
        List<Article> articleList = articleService.list(queryWrapper);
        System.out.println(articleList);
        return ResultUtils.success(articleList);
    }
}
